<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>传媒人后台管理</title>
<?= HTML::style('static/bootstrap-3.3.7/css/bootstrap.min.css')?>
<?= HTML::style('static/font-awesome/css/font-awesome.min.css')?>
<?= HTML::style('static/adminlte/AdminLTE.min.css')?>
<?= HTML::style('static/adminlte/skins/skin-blue.min.css')?>
<style>
@media (max-width: 767px){
.skin-blue .main-header .navbar .dropdown-menu li a{color: #555}
.skin-blue .main-header .navbar .dropdown-menu li a:hover{color: #fff}
}
</style>
<?= HTML::script('static/js/jquery-1.12.4.min.js')?>
<?= HTML::script('static/bootstrap-3.3.7/js/bootstrap.min.js')?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  <header class="main-header">
    <a href="<?= URL::site()?>" class="logo ajax-click">
      <span class="logo-mini"><i class="glyphicon glyphicon-home"></i></span>
      <span class="logo-lg"><i class="glyphicon glyphicon-home"></i>&nbsp;传媒人后台管理</span>
    </a>
    <nav class="navbar navbar-static-top">
      <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <div class="navbar-custom-menu">
		<ul class="nav navbar-nav">
		    <li class="dropdown">
		        <a href="#" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i>&nbsp;<?= $user['username']?><span class="caret"></span></a>
                <ul class="dropdown-menu">
			        <li><a href="<?= URL::site('admin/password')?>" class="ajax-modal-sm">&nbsp;修改密码</a></li>
			        <li><a href="<?= URL::site('admin/logout')?>">&nbsp;退出</a></li>
                </ul>
            </li>
		</ul>
      </div>
    </nav>
  </header>
  
  <aside class="main-sidebar">
    <section class="sidebar">
      <ul class="sidebar-menu">
        <li class="header">MAIN NAVIGATION</li>
	    <?php foreach ($menu as $name=>$items):?>
	    <?php if(is_array($items)):?>
		<li class="treeview">
		    <a href="#">
		        <i class="fa fa-circle-o text-yellow"></i>
		        <span><?= $name?></span>
		        <i class="fa fa-angle-left pull-right"></i>
		    </a>
		    <ul class="treeview-menu">
			    <?php foreach ($items as $sub_name=>$url):?>
				<li class="<?php if($uri==$url):?>curr<?php endif;?>">
				    <a class="ajax-click" href="<?= URL::site($url)?>"><i class="fa fa-circle-o"></i> <?= $sub_name?></a>
				</li>
			    <?php endforeach;?>
		    </ul>
		</li>
		<?php else:?>
		<li class="<?php if($uri==$items):?>active<?php endif;?>">
		    <a class="ajax-click" href="<?= URL::site($items)?>"><i class="fa fa-circle-o text-red"></i> <span><?= $name?></span></a>
		</li>
		<?php endif;?>
	    <?php endforeach;?>
      </ul>
    </section>
  </aside>
  
  <div class="content-wrapper" style="background: #fff">
    <section class="content" id="content">
    <?= $content?>
    </section>
  </div>
</div>
  
<div class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span>&times;</span></button>
                <h4 class="modal-title">提示</h4>
            </div>
            <div class="modal-body"></div>
        </div>
    </div>
</div>

<?= HTML::script('static/adminlte/app.js')?>
<script>
$(function(){
	$('.treeview-menu li.curr').parents('.treeview').attr('class', 'treeview active');
	$(document).on('click', '.treeview-menu .ajax-click', function() {
		$('body').removeClass('sidebar-open');
	});

	var m = $('.modal').eq(0);
	$(document).on('click', '.ajax-modal, .ajax-modal-sm, .ajax-modal-lg', function(){
		var t = $(this);
	    var d = m.find('.modal-dialog');
	    d.removeClass('modal-sm');
	    d.removeClass('modal-lg');
		if (t.hasClass('ajax-modal-sm')) {
			d.addClass('modal-sm');
    	} else if (t.hasClass('ajax-modal-lg')) {
			d.addClass('modal-lg');
    	}
    	
		var url = this.href;
		$.get(url, function(res) {
			m.find('.modal-body').html(res);
			m.modal('show');
		});
		return false;
	});
	$('.modal').on('show.bs.modal', function (e) {
		var t = $(this);
		var page_title = t.find('.page-header');
        t.find('.modal-title').html(page_title.html());
        t.find('form').attr('class', '');
        page_title.hide();
	});
});
</script>
</body>
</html>
